﻿using System.Collections.Generic;
using System.Linq;
using WalkingTec.Mvvm.Core;
using SelfService.Model.Models;
using WalkingTec.Mvvm.Core.Extensions;


namespace SelfService.ViewModel.SysMedicalProjectVMs
{
    public partial class SysMedicalProjectListVm : BasePagedListVM<SysMedicalProjectView, SysMedicalProjectSearcher>
    {

        protected override IEnumerable<IGridColumn<SysMedicalProjectView>> InitGridHeader()
        {
            return new List<GridColumn<SysMedicalProjectView>>{
                this.MakeGridHeader(x => x.Name),
                this.MakeGridHeader(x => x.Code),
                this.MakeGridHeader(x => x.Price),
                this.MakeGridHeader(x => x.IsControlQty),
                this.MakeGridHeader(x => x.CreateTime),
                this.MakeGridHeader(x => x.UpdateTime),
                this.MakeGridHeaderAction(width: 200)
            };
        }

        public override IOrderedQueryable<SysMedicalProjectView> GetSearchQuery()
        {
            var query = DC.Set<SysMedicalProject>()
                .CheckEqual(Searcher.IsDisable, x => x.IsDisable)
                .Select(x => new SysMedicalProjectView
                {
				    ID = x.ID,
                    Name = x.Name,
                    Code = x.Code,
                    Price = x.Price,
                    IsControlQty = x.IsControlQty,
                    CreateTime = x.CreateTime,
                    UpdateTime = x.UpdateTime,
                })
                .OrderBy(x => x.ID);
            return query;
        }

    }

    public class SysMedicalProjectView : SysMedicalProject{

    }
}
